public class Test {
    public void clear() {
        ListNode cur = head;
        while(cur != null) {
            ListNode curN = cur.next;
            if(cur = head) {
                cur.next = null;
            }else {
                if(cur.next == null) {
                    cur.prev = null;
                    return;
                }
                cur.prev = null;
                cur.next = null;
            }
            cur = curN;
        }
    }
}
